package codeGen.core;

import codeGen.core.model.TableModel;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class ViewGen {
    public static void genCode(TableModel tModel, File output) {
        try {
            File view_new = new File(output, "new.jsp");
            FreemarkerUtil.genResource("view_new.ftl", new FileOutputStream(view_new), tModel);
            File view_list = new File(output, "list.jsp");
            FreemarkerUtil.genResource("view_list.ftl", new FileOutputStream(view_list), tModel);
            File view_edit = new File(output, "edit.jsp");
            FreemarkerUtil.genResource("view_edit.ftl", new FileOutputStream(view_edit), tModel);
            File view_info = new File(output, "info.jsp");
            FreemarkerUtil.genResource("view_info.ftl", new FileOutputStream(view_info), tModel);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}
